﻿Public Class TypeNodeVm
    Inherits NodeVm

    'Public Property ObjectTree As ObjectTree

    Public Sub New(objectType As ObjectType, library As RawLibrary, objectTree As ObjectTree)
        MyBase.New(objectTree)

        Me.Name = objectType.ToString
        Me.ObjectTree = objectTree
        Me.ObjectType = objectType
        Me.ObjectSubType = TokenLib.ObjectSubType.ALL

        Objects = New List(Of ObjectNodeVm)
        For Each obj As RawObject In library.GetObjectsByType(objectType).OrderBy(Function(x) x.ObjectId)
            Objects.Add(New ObjectNodeVm(obj, Me, objectTree))
        Next
    End Sub

    Public Property Name As String
    Public Property Objects As List(Of ObjectNodeVm)

    Protected Overrides Sub BuildContextMenuInternal(list As List(Of MenuInfo))
        list.Add(New MenuInfo("New " & Replace(Name, "_", "__"), "/Icons/AddObject.png", Command.NotImplementedCommand))
    End Sub

End Class